package cate.game.train.rune.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import easy.java.dev.note.NoteField;

import java.util.List;

@ClientMsg(title = "徽章重铸 の 请求")
@OperationSetter(GDOperation.RUNE_RECAST)
public class RuneRecastReq implements MsgInput {
    @NoteField(value = "徽章uid")
    public String runeUid;

    @NoteField(value = "英雄uid", detail = "如果是英雄身上的徽章还需要传英雄id")
    public String heroUid;

    @NoteField(value = "部位ID", detail = "如果是英雄身上的徽章还需传部位id")
    public byte pos;

    @NoteField(value = "使用幸运重铸道具", detail = "直接触发幸运重铸")
    public boolean useLuckyItem;

    @NoteField("使用永恒徽章重铸道具")
    public boolean useLuckyItem2;

    @NoteField(value = "重铸类型")
    public byte type;

    @NoteField(value = "选择的两个自定义技能ID")
    public List<Integer> chooseLuckySkills;

    @NoteField(value = "选择的自定义基础属性")
    public List<Integer> chooseAttrs;

    @NoteField(value = "选择的自定义进阶属性")
    public List<Integer> chooseGradeAttrs;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = game.train.rune.reforge(cc.getRole(),
                runeUid,
                heroUid,
                pos,
                type,
                useLuckyItem,
                useLuckyItem2,
                chooseLuckySkills, chooseAttrs, chooseGradeAttrs);
        if(!r.ok()){
            game.notice.message(cc.getRole(), r, true);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.RUNE_RECAST_REQ;
    }
}
